package com.task.manager.mapper;

import com.task.manager.domain.SysConfig;
import org.apache.ibatis.jdbc.SQL;

public class SysConfigSqlProvider {

    public String insertSelective(SysConfig record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("t_sys_config");
        
        if (record.getId() != null) {
            sql.VALUES("ID", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getMoudleCode() != null) {
            sql.VALUES("MOUDLE_CODE", "#{moudleCode,jdbcType=VARCHAR}");
        }
        
        if (record.getSysKey() != null) {
            sql.VALUES("SYS_KEY", "#{sysKey,jdbcType=VARCHAR}");
        }
        
        if (record.getSysValue() != null) {
            sql.VALUES("SYS_VALUE", "#{sysValue,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("CREATE_TIME", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(SysConfig record) {
        SQL sql = new SQL();
        sql.UPDATE("t_sys_config");
        
        if (record.getMoudleCode() != null) {
            sql.SET("MOUDLE_CODE = #{moudleCode,jdbcType=VARCHAR}");
        }
        
        if (record.getSysKey() != null) {
            sql.SET("SYS_KEY = #{sysKey,jdbcType=VARCHAR}");
        }
        
        if (record.getSysValue() != null) {
            sql.SET("SYS_VALUE = #{sysValue,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("ID = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}